//全局颜色
var colorlist = ['#02C5FB', '#68C706', '#02FBE7', '#0078E9', '#FBDB04', '#F58F1C', '#F1423A', '#0096f3', '#33CCFF', '#33FFCC'];
//背景颜色
var bgcolor = 'transparent';
//全局渐变颜色
var jbcolor = ['#00feff', '#027eff', '#0286ff'];
var charts = {
    /*
            yAxisName: '失业率',   // y轴名称
            unit: '%',		      // 数据单位，可传数组或字符串，对应type索代表的数据
            isBarRadius:false,    // 柱状图-柱子是否为圆角，默认圆角，可传具体数值（圆角宽度）
            isSmooth: false,      // 折线图-是否平滑，不传为平滑
            barcolor.baseColor    // 象柱图底色
            barcolor.colorlist    // 柱状图、象柱图柱子颜色，morecolor：true生效
            showValue:true
        */
    //初始化图表
    init: function (data, opt, clickfun) {
        var elem = $(data.element)[0];
        var myMap = echarts.getInstanceByDom(elem) || echarts.init(elem);; //声明画布
        var option1; //声明变量
        switch (data.type) {
            case 'pie':
                option1 = this.pie(data);
                break;
            case 'radar':
                option1 = this.radar(data);
                break;
            case 'pictorialBar':
                option1 = this.pictorialBar(data);
                break;
            case 'panel':
                option1 = this.panel(data);
                break;
            case 'progressBar':
                option1 = this.progressBar(data);
                break;
            case 'circle':
                option1 = this.circle(data);
                break;
            default:
                option1 = this.bar(data);
                break;
        }
        opt ? (option1 = opt(option1)) : '';
        myMap.setOption(option1);
        myMap.off('click');
        if (clickfun) {
            myMap.on('click', function (parem) {
                clickfun(parem);
            });
        }
        return myMap;
    },
    //柱状图与折线图
    bar: function (data) { //柱状图与折线图
        var series = [];
        var barLen = 0;
        if (!(typeof data.type == 'string')) {
            $.each(data.type, function (i, item) {
                if (item == 'bar') {
                    barLen++;
                }
            })
        }
        var barWidth = barLen > 0 ? (parseInt(100 / data.data.xdata.length / barLen) + '%') : (parseInt(100 / data.data.xdata.length) + '%'); //柱子宽度自适应
        barWidth = 20
        var fontSize = data.fontSize || 12
        $.each(data.data.ydata, function (i) {
            if (data.barcolor.morecolor) {
                var jbcolor1 = data.barcolor.colorlist;
                if (jbcolor1 == undefined) {
                    jbcolor1 = colorlist;
                }
                if (typeof data.type == 'string') {
                    series.push({
                        name: data.data.name[i],
                        type: data.type,
                        barWidth: barWidth,
                        barMaxWidth: '25%',
                        xAxisIndex: 0,
                        smooth: data.hasOwnProperty('isSmooth') ? data.isSmooth : true,
                        yAxisIndex: 0,
                        itemStyle: {
                            normal: {
                                color: jbcolor1[i],
                               
                                barBorderRadius: data.hasOwnProperty('isBarRadius') ? (data.isBarRadius ? data.isBarRadius : 0) : 30,
                            }
                        },
                        data: this,
                        zlevel: 11

                    })
                } else {
                    series.push({
                        name: data.data.name[i],
                        type: data.type[i],
                        barWidth: barWidth,
                        smooth: data.hasOwnProperty('isSmooth') ? data.isSmooth : true,
                        xAxisIndex: 0,
                        yAxisIndex: 0,
                        itemStyle: {
                            normal: {
                                color: jbcolor1[i],
                                barBorderRadius: data.hasOwnProperty('isBarRadius') ? (data.isBarRadius ? data.isBarRadius : 0) : 30,
                            }
                        },
                        data: this,
                        zlevel: 11

                    })
                }
            } else {
                var jbcolor1 = jbcolor;
                if (data.barcolor.color != undefined) {
                    jbcolor1 = barcolor;
                }

                if (typeof data.type == 'string') {
                    series.push({
                        name: data.data.name[i],
                        type: data.type,
                        barWidth: barWidth,
                        smooth: data.hasOwnProperty('isSmooth') ? data.isSmooth : true,
                        xAxisIndex: 0,
                        yAxisIndex: 0,
                        itemStyle: {
                            normal: {
                                barBorderRadius: data.hasOwnProperty('isBarRadius') ? (data.isBarRadius ? data.isBarRadius : 0) : 30,
                                color: colorlist[i]
                            }
                        },
                        areaStyle: {
                            color: colorlist[i],
                            opacity: .2
                        },
                        data: this,
                        zlevel: 11

                    })
                } else {
                    series.push({
                        name: data.data.name[i],
                        type: data.type[i],
                        barWidth: barWidth,
                        smooth: data.hasOwnProperty('isSmooth') ? data.isSmooth : true,
                        xAxisIndex: 0,
                        yAxisIndex: 0,
                        itemStyle: {
                            normal: {
                                barBorderRadius: data.hasOwnProperty('isBarRadius') ? (data.isBarRadius ? data.isBarRadius : 0) : 30,
                                color: colorlist[i]
                            }
                        },
                        areaStyle: {
                            color: "rgba(5,140,255, 0.2)"
                        },
                        data: this,
                        zlevel: 11

                    })
                }

            }

        })
        var xAxis = [],
            yAxis = [];
        if (data.isTransverse) {
            xAxis.push({
                type: 'value',
                show: false,
                name: data.unit || '',
                nameTextStyle: {
                    color: "#8BB4FF"
                },
                gridIndex: 0,
                splitLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },

                axisLine: {
                    lineStyle: {
                        color: '#0c3b71'
                    }
                },
                axisLabel: {
                    color: data.xAxisColor || '#4066AB',
                    formatter: '{value}'
                }
            });
            yAxis.push({
                type: 'category',
                name: data.data.unit || '',
                gridIndex: 0,
                inverse: true,
                data: data.data.xdata,
                axisTick: {
                    alignWithLabel: false
                },
                axisLine: {
                    // show:false,
                    lineStyle: {
                        color: '#2c5b8f'
                    }
                },
                axisLabel: {
                    show: true,
                    color: data.yAxisColor || '#4066AB',
                    fontSize: fontSize
                }
            })
        } else {
            xAxis.push({
                type: 'category',
                gridIndex: 0,
                data: data.data.xdata,
                axisTick: {
                    alignWithLabel: true
                },
                axisLine: {
                    lineStyle: {
                        color: '#4c88c6'
                    }
                },
                axisLabel: {
                    show: true,
                    color: data.xAxisColor || '#4c88c6',
                    fontSize: fontSize
                }
            });
            yAxis.push({
                type: 'value',
                name: (data.yAxisName ? (data.unit ? (data.yAxisName + '/' + data.unit) : data.yAxisName) : ''),
                nameTextStyle: {
                    color: data.yAxisColor || "#4c88c6",
                    align: 'center'
                },
                gridIndex: 0,
                splitLine: {
                    show: data.yAxisSplitLineShow||false,
                    lineStyle: {
                        color: '#5677F2',
                        type :'dashed',
                        width:0.5,
                        opacity: 0.3,

                    }
                },
                axisTick: {
                    show: false
                },
                // min: min,
                // max: 100,
                axisLine: {
                    show:data.yaxisLineShow || true,
                    lineStyle: {
                        color: '#4c88c6'
                    }
                },
                axisLabel: {
                    color: data.yAxisColor || '#4c88c6',
                    formatter: function (value, index) {
                        if (data.yAxisType == '1') {
                            value /= 10000;
                        }else if(data.yAxisType == '2'){
                            value= value+"  元"
                           
                        }
                       
                        return value;
                    }
                }
            })
        }
        var option = {
            backgroundColor: bgcolor,
            tooltip: {
                trigger: 'axis',
                // axisPointer: {
                //     // type: 'line',
                //     lineStyle: {
                //         opacity: 0
                //     }
                // },
                // formatter: function (params) {
                //     var str = '',
                //         unit = data.unit ? data.unit : '';
                //     if (params.length > 1) {
                //         str = params[0].name + '<br/>';
                //         $.each(params, function (i, item) {
                //             str += '<p>' + item.seriesName + '：' + item.data + (typeof data.unit == 'string' ? unit : data.unit[i]) + '</p>'
                //         })
                //     } else {
                //         str = params[0].name + "：" + params[0].data + unit;
                //     }

                //     return str;
                // }
                // formatter: function(prams) {

                //         return  prams[0].name+"：" + prams[0].data+(data.unit?('('+data.unit+')'):'')
                //         //return data.data.name+"：" + prams[0].data + "%"
                // }
            },
            //		    legend: {
            //		        data: data.data.name,
            //		        show: false
            //		    },
            grid: {
                left: '1%',
                right: '5%',
                bottom: '5%',
                top: data.yAxisName ? '20%' : '10%',
                containLabel: true,
                z: 22
            },
            xAxis: xAxis,
            yAxis: yAxis,
            series: series
        };
        return option;
    },
    //饼图
    pie: function (data) {
        var datas = charts.pienum(data.data);
        var fontSize = data.fontSize || 12;
        var center = ['50%', '50%'];
        var series = [];
        var colorlist_ = data.barcolor.colorlist || colorlist;
        var title = [];
        if (data['showlegend']['islengend'] && data['showlegend']['center'] == undefined) {
            center = ['30%', '50%']
        }
        if (data['showlegend']['center'] != undefined) {
            center = data.showlegend.center;
        }
        if (data.isMore) {
            $.each(datas, function (i) {
                title.push({
                    text: this.name,
                    left: i * (100 / datas.length) + 15 + '%',
                    bottom: '0%',

                    textAlign: 'center',
                    textStyle: {
                        fontSize: fontSize,
                        color: '#fff',
                        fontWeight: '400',
                    },
                })
                series.push({
                    name: this.name,
                    type: 'pie',
                    clockWise: false,
                    radius: ['30', '40'],
                    itemStyle: {
                        normal: {
                            color: colorlist_[i],
                            shadowColor: '#fff',
                            shadowBlur: 0,
                            label: {
                                show: false
                            },
                            labelLine: {
                                show: false
                            },
                        }
                    },
                    hoverAnimation: false,
                    center: [i * (100 / datas.length) + 15 + '%', '50%'],
                    data: [{
                        value: this.value,
                        label: {
                            normal: {
                                formatter: function (params) {
                                    return params.value + '%';
                                },
                                position: 'center',
                                show: true,
                                textStyle: {
                                    fontSize: fontSize,
                                    color: '#fff'
                                }
                            }
                        },
                    }, {
                        value: 100 - this.value,
                        name: this.name,
                        itemStyle: {
                            normal: {
                                color: "#2B3350"
                            },
                            emphasis: {
                                color: ''
                            }
                        },
                        label: {
                            show: false
                        }
                    }]
                })
            });
        } else {
            series.push({
                name: data.data.name[0],
                type: 'pie',
                radius: '55%',
                center: center,
                radius: data['isPie'] == undefined ? ["30%", "50%"] : data['isPie'],
                roseType: data.roseType == true ? 'area' : false,
                data: datas,
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    },
                    normal: {
                        label: {
                            show: false,
                            //			                            position:'inside',
                            formatter: '{b} : {c} ({d}%)'
                        },
                        borderColor: '#ffffff',
                        borderWidth: 0,
                    },
                    labelLine: {
                        show: true
                    }
                }
            })
        }
        var xDatas = [];
        if (data['icon']) {
            $.each(data.data.xdata, function (i, item) {
                xDatas.push({
                    name: item,
                    icon: data['icon']
                })
            })
        }
        var option = {
            title: title,
            legend: {
                // type:'scroll',
                show: data['showlegend']['islengend'] || false,
                textStyle: {
                    "color": "#fff",
                    "fontSize": fontSize
                },
                orient: 'vertical',
                right: 10,
                top: 20,
                bottom: 20,
                width: data['showlegend']['width'] || '20%',
                //			        right:0,
                //			        itemGap: 20,
                pageIconColor: '#fff',
                pageTextStyle: {
                    color: '#fff'
                },
                data: data['icon'] ? (xDatas) : (data.data.xdata),
                formatter: function (name) {
                    var val = 0;
                    $.each(datas, function (i, obj) {
                        if (obj.name == name) {
                            val = obj.value
                        }
                    })
                    if (data.showlegend.isformatter) {
                        return "{title|" + name + "}   {value|" + (val) + "} "
                    } else {
                        return "{title|" + name + "} "
                    }
                },

                textStyle: {
                    rich: {
                        title: {
                            fontSize: fontSize,
                            color: data.showlegend.titleColor || "rgb(0, 178, 246)"
                        },
                        value: {
                            fontSize: fontSize,
                            color: data.showlegend.valueColor || "#fff"
                        }
                    }
                },
            },
            color: colorlist_,
            series: series
        };
        return option;
    },
    //雷达图
    radar: function (data) {
        colorlist = [], colorRgba = '';
        var colorlist1 = data.barcolor && data.barcolor.colorlist || colorlist;
        var colorRgba1 = data.barcolor && data.barcolor.colorRgba || colorRgba;
        var indicator = [],
            datas = [],
            fontSize = data.fontStyle || 12,
            max = 0;
        $.each(data.data.ydata, function () {
            if (this instanceof Array) {
                $.each(this, function () {
                    var num = parseFloat(this)
                    if (num > max) {
                        max = num;
                    }
                });
            } else {
                var num = parseFloat(this)
                if (num > max) {
                    max = num;
                }
            }
        });

        datas.push({
            value: data.data.ydata,
            name: data.data.name,
            areaStyle: {
                normal: {
                    color: colorRgba1[0]
                }
            }
        })
        if (data.data.max != undefined) {
            max = data.data.max;
        }
        $.each(data.data.xdata, function (i, val) {
            indicator.push({
                name: val,
                max: max
            })
        })

        var option = {
            color: colorlist1,
            tooltip: {
                show: true // 弹层数据去掉
            },
            radar: {
                center: ['50%', '50%'], // 外圆的位置
                name: {
                    textStyle: {
                        color: 'rgba(255,255,255,.85)',
                        fontSize: fontSize,
                        fontWeight: 400,
                        fontFamily: 'PingFangSC-Regular,PingFang SC'
                    }
                },
                // TODO:
                indicator: indicator,
                splitArea: {
                    // 坐标轴在 grid 区域中的分隔区域，默认不显示。
                    show: true,
                    areaStyle: {
                        // 分隔区域的样式设置。
                        color: ['rgba(0, 0, 0, 0)'] // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
                    }
                },
                axisLine: {
                    // 指向外圈文本的分隔线样式
                    lineStyle: {
                        color: 'rgba(255,255,255,0.2)'
                       
                    }
                },
                splitLine: {
                    lineStyle: {
                        type: 'dashed',
                        color: 'rgba(230,230,230,.5)', // 分隔线颜色
                        width: 1 // 分隔线线宽
                    }
                }
            },
            series: [{
                type: 'radar',
                data: datas
            }]
        }
        return option;
    },
    //组装饼图数据
    pienum: function (data, name) {
        var datas = [];
        $.each(data['ydata'], function (i, val) {
            datas.push({
                name: data['xdata'][i],
                value: val,

            });
        })
        return datas;
    },
    pictorialBar: function (data) { //象柱图
        var xData = [],
            xBaseData = [],
            colorList = [];
        $.each(data.data.xdata, function (i, item) {
            if (data.barcolor.morecolor) {
                colorList = data.barcolor.colorlist;
                xData.push({
                    value: item,
                    itemStyle: {
                        color: (i > colorList.length - 1 ? colorList[colorList.length - 1] : colorList[i])
                    }
                });
            }
            xBaseData.push(1); //底柱子
        });
        var option = {
            legend: {
                show: false
            },
            tooltip: {
                trigger: 'item',
                position: 'right',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                left: 100
            },
            yAxis: {
                data: data.data.ydata,
                inverse: true,
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                axisLabel: {
                    margin: 100,
                    fontSize: 14,
                    align: 'left',
                    color: '#ffffff',
                },
                axisPointer: {
                    label: {
                        show: true,
                        margin: 30
                    }
                }
            },
            xAxis: {
                splitLine: {
                    show: false
                },
                axisLabel: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                axisLine: {
                    show: false
                }
            },
            series: [{
                    z: 4,
                    tooltip: {
                        show: false
                    },
                    type: "pictorialBar",
                    symbolSize: ['30', '30'],
                    symbolRepeat: "fixed",
                    symbol: 'rect',
                    // barGap: 0,
                    symbolMargin: 0,
                    itemStyle: {
                        color: (data.barcolor.baseColor ? data.barcolor.baseColor : '#010544')
                    },
                    data: xBaseData
                },
                {
                    z: 6,
                    name: data.data.name ? data.data.name : '值',
                    type: 'pictorialBar',
                    symbolRepeat: 'fixed',
                    symbolSize: ['30', '30'],
                    symbol: 'rect',
                    barCategoryGap: '100%',
                    symbolOffset: [0, 0],
                    symbolPosition: 'start',
                    symbolClip: true,
                    // barGap: 0,
                    symbolMargin: 0,
                    data: xData,
                    label: {
                        normal: {
                            show: data.hasOwnProperty('showValue') ? data.showValue : true,
                            textStyle: {
                                color: '#fff',
                                fontSize: 20,

                            },
                            position: "right",
                            offset: [15, 0]
                        }
                    }
                }
            ]
        };
        return option;
    },
    panel: function (data) {
        var fontColor = "#fff";
        var state = "";
        var center = ["50%", "50%"];
        var wqradius = '56%';
        var nqradius = '73%';
        var nqColor = [
            [
                data.value,
                data.color
            ],
            [
                1,
                "rgba(28, 45, 100, .8) "
            ]
        ];

        var wqColor = data.color;
        return {
            title: {
                show: true,
                x: "center",
                bottom: "8%",
                text: data.title,
                textStyle: {
                    fontWeight: "700",
                    fontSize: 20,
                    color: fontColor
                }
            },
            tooltip: {
                show: false
            },
            series: [{
                    name: "指针",
                    type: "gauge",
                    z: 9,
                    radius: "70%",
                    startAngle: -135,
                    endAngle: -45,
                    center: center, //整体的位置设置
                    axisLine: {
                        lineStyle: {
                            // 属性lineStyle控制线条样式//指针颜色
                            color: [
                                [1, "rgb(30, 191, 182)"]
                            ],
                            width: 0
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    splitLine: {
                        show: false
                    },
                    axisLabel: {
                        show: false
                    },
                    min: 0,
                    max: 1,
                    pointer: {
                        show: false,
                        width: 10,
                        length: "60%"
                    },
                    itemStyle: {
                        normal: {
                            color: wqColor
                        }
                    },
                    detail: {
                        show: true,
                        offsetCenter: [0, 0],
                        formatter: [
                            "{value|" + ((data.value * 100).toFixed(1)) + "} {company|%}",
                            "{company|" + state + "}"
                        ].join("\n"),
                        rich: {
                            value: {
                                fontSize: 30,
                                lineHeight: 10,
                                color: "#FF9630",
                                fontWeight: "700"
                            },
                            company: {
                                fontSize: 25,
                                lineHeight: 20,
                                color: "#fff"
                            }
                        },

                    },
                    data: [data.value] //指针位置
                },
                {
                    name: "内层盘",
                    type: "gauge",
                    z: 6,
                    radius: nqradius,
                    center: center, //整体的位置设置
                    axisLine: {
                        lineStyle: {
                            // 属性lineStyle控制线条样式//控制外圈位置
                            color: nqColor,
                            width: 13,
                            opacity: 0.9 //控制外圈位置，颜色，宽度，透明度
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    splitLine: {
                        show: false
                    },
                    axisLabel: {
                        show: false
                    },
                    pointer: {
                        show: false
                    },
                    // data: [
                    //   {
                    //     show: false,
                    //     value:0.8
                    //   }
                    // ],
                    detail: {
                        show: 0
                    }
                },
                {
                    name: "内层圈", //刻度背景
                    type: "gauge",
                    z: 2,
                    radius: wqradius,
                    startAngle: -135,
                    endAngle: -45,
                    center: center, //整体的位置设置
                    axisLine: {
                        // 坐标轴线
                        lineStyle: {
                            // 属性lineStyle控制线条样式
                            color: [
                                [1, wqColor]
                            ],
                            width: 1,
                            opacity: 1 //刻度背景宽度
                        }
                    },
                    splitLine: {
                        show: false
                    },
                    // data: [
                    //   {
                    //     show: false,
                    //     value: data.value
                    //   }
                    // ], //作用不清楚
                    axisLabel: {
                        show: false
                    },
                    pointer: {
                        show: false
                    },
                    axisTick: {
                        show: false
                    },
                    detail: {
                        show: 0
                    }
                },
            ]
        }
    },
    progressBar: function (data) {
        data.valuePosition = data.hasOwnProperty('valuePosition')?data.valuePosition:'top';
        data.showValue = data.hasOwnProperty('showValue')?data.showValue:true;
        data.isPie = data.hasOwnProperty('isPie') ? data.isPie : true;
        if (!data.total) {
            if (typeof data.value == 'string' && data.value.indexOf('%') > -1) {
                data.total = 100;
                data.value = parseFloat(data.value.split('%')[0])
            } else {

            }
            if (data.value >= 0 && data.value <= 1) {
                data.total = 1;
            }
        }
        var option = {
            grid: {
                top: 0,
                left: 0,
                right: '15%',
                bottom: 0
            },
            xAxis: [{
                show: false,
            }],
            yAxis: [{
                axisTick: 'none',
                axisLine: 'none',
                offset: '27',
                axisLabel: {
                    show: false,
                    textStyle: {
                        color: '#ffffff',
                        fontSize: '16',
                    }
                },
                data: ['8']
            }, {
                axisTick: 'none',
                axisLine: 'none',
                axisLabel: {
                    show: false,
                    textStyle: {
                        color: '#ffffff',
                        fontSize: '16',
                    }
                },
                data: ['100']
            }, {
                name: '单位：件',
                nameGap: '50',
                nameTextStyle: {
                    color: '#ffffff',
                    fontSize: '16',
                },
                axisLine: {
                    lineStyle: {
                        color: 'rgba(0,0,0,0)'
                    }
                },
                data: [],
            }],
            series: [{
                    name: '条',
                    type: 'bar',
                    yAxisIndex: 0,
                    data: [data.value],
                    label: {
                        normal: {
                            offset: [30, 0],
                            show: data.showValue,
                            position: data.valuePosition,
                            formatter: function (param) {
                                return '{value|'+param.value+'}' + '{unit|%}';
                            },
                            rich:{
                                value:{
                                    color:'#FF9630',
                                    fontSize:20,
                                    padding:[0,0,0,0]
                                },
                                unit:{
                                    color:'#fff'
                                }
                            }
                        }
                    },
                    barWidth: 15,
                    itemStyle: {
                        normal: {
                            color: {
                                type: 'linear',
                                x: 0,
                                y: 0,
                                x2: 0,
                                y2: 1,
                                colorStops: [{
                                    offset: 0,
                                    color: 'rgba(255, 162, 91, 1)' // 0% 处的颜色
                                }, {
                                    offset: 1,
                                    color: 'rgba(254, 96, 117, 1)' // 100% 处的颜色
                                }]
                            },
                            barBorderRadius: 25,
                        }
                    },
                    z: 2
                },
                {
                    name: '外框',
                    type: 'bar',
                    yAxisIndex: 2,
                    barGap: '-100%',
                    data: [data.total],
                    barWidth: 15,
                    itemStyle: {
                        normal: {
                            color: 'rgba(14, 34, 99, 1)',
                            barBorderRadius: 25,
                        }
                    },
                    z: 0
                }
            ]
        };
        if (data.isPie) {
            option.series.push({
                type: 'pie',
                center: [data.value + '%', '50%'],
                radius: ['0', '35%'],
                clockwise: true,
                avoidLabelOverlap: true,
                hoverOffset: 15,
                itemStyle: {
                    normal: {
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(255, 162, 91, 1)' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(254, 96, 117, 1)' // 100% 处的颜色
                            }]
                        },
                    }
                },
                label: {
                    show: false,

                },
                labelLine: {
                    show: false,

                },
                data: [{
                    'name': data.name||'北京',
                    'value': 100
                }],
            })
        }
        return option;
    },
    circle: function (data) {
        data.showValue = data.hasOwnProperty('showValue')?data.showValue:true;
        if (!data.data.total) {
            if (typeof data.data.value == 'string' && data.data.value.indexOf('%') > -1) {
                data.data.total = 100;
                data.data.value = parseFloat(data.data.value.split('%')[0])
            } else {

            }
            if (data.data.value >= 0 && data.data.value <= 1) {
                data.data.total = 1;
            }
        }
        var value = (data.data.value / data.data.total * 100);
        value = (value == 100 ? value : value.toFixed(2));
        var option = {
            backgroundColor: 'transparent',
            tooltip: {
                show: false,
            },
            legend: {},
            series: [
                {
                name: data.data.name || '数据',
                type: 'pie',
                radius: ['55%', '65%'],
                legendHoverLink: false,
                hoverAnimation: false,
                animation: false,
                avoidLabelOverlap: false,
                label: {
                    show: data.showValue,
                    position: 'center',
                    formatter:function(params){
                        return '{value|'+value+'}' + '{unit|%}';
                    },
                    rich:{
                        value:{
                            color:'#FF9630',
                            fontSize:24,
                            padding:[0,3,0,0]
                        },
                        unit:{
                            color:'#fff'
                        }
                    }
                    
                },
                labelLine: {
                    normal: {
                        show: false
                    }
                },
                data: [{
                        value: data.data.value,
                        itemStyle: {
                            normal: {
                                color: data.barcolor.valueColor || "#15E79C"
                            }
                        }
                    },
                    {
                        value: data.data.total - data.data.value,
                        itemStyle: {
                            normal: {
                                color: data.barcolor.bgColor || "rgba(4,40,50,1)"
                            }
                        }
                    },


                ]
            }]
        };
        return option;
    }
}